.class final Lcom/melesta/engine/EngineActivity$18;
.super Ljava/lang/Object;
.source "EngineActivity.java"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/melesta/engine/EngineActivity;->checkPromocode(Ljava/lang/String;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = null
.end annotation


# instance fields
.field final synthetic val$code:Ljava/lang/String;

.field final synthetic val$ea:Lcom/melesta/engine/EngineActivity;


# direct methods
.method constructor <init>(Lcom/melesta/engine/EngineActivity;Ljava/lang/String;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 1962
    iput-object p1, p0, Lcom/melesta/engine/EngineActivity$18;->val$ea:Lcom/melesta/engine/EngineActivity;

    iput-object p2, p0, Lcom/melesta/engine/EngineActivity$18;->val$code:Ljava/lang/String;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public run()V
    .locals 12

    .prologue
    const/4 v11, 0x0

    .line 1967
    const/4 v1, 0x1

    .line 1969
    .local v1, errCode:I
    :try_start_0
    iget-object v8, p0, Lcom/melesta/engine/EngineActivity$18;->val$ea:Lcom/melesta/engine/EngineActivity;

    #calls: Lcom/melesta/engine/EngineActivity;->getUserEmail()Ljava/lang/String;
    invoke-static {v8}, Lcom/melesta/engine/EngineActivity;->access$600(Lcom/melesta/engine/EngineActivity;)Ljava/lang/String;

    move-result-object v3

    .line 1970
    .local v3, gmail:Ljava/lang/String;
    iget-object v8, p0, Lcom/melesta/engine/EngineActivity$18;->val$ea:Lcom/melesta/engine/EngineActivity;

    const/4 v9, 0x0

    iget-object v10, p0, Lcom/melesta/engine/EngineActivity$18;->val$code:Ljava/lang/String;

    #calls: Lcom/melesta/engine/EngineActivity;->postPromocodeRequest(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    invoke-static {v8, v9, v3, v10}, Lcom/melesta/engine/EngineActivity;->access$700(Lcom/melesta/engine/EngineActivity;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    .line 1971
    .local v5, res:Ljava/lang/String;
    if-eqz v5, :cond_0

    .line 1972
    const-string v8, "checkPromocode"

    invoke-static {v8, v5}, Lcom/melesta/engine/Log;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 1973
    new-instance v4, Lorg/json/JSONObject;

    invoke-direct {v4, v5}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 1974
    .local v4, jo:Lorg/json/JSONObject;
    const-string v8, "rs"

    invoke-virtual {v4, v8}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result v6

    .line 1975
    .local v6, rs:I
    const/4 v8, 0x1

    if-ne v6, v8, :cond_1

    .line 1976
    const/4 v1, 0x0

    .line 1989
    .end local v4           #jo:Lorg/json/JSONObject;
    .end local v6           #rs:I
    :cond_0
    :goto_0
    iget-object v8, p0, Lcom/melesta/engine/EngineActivity$18;->val$ea:Lcom/melesta/engine/EngineActivity;

    invoke-virtual {v8, v11}, Lcom/melesta/engine/EngineActivity;->showWaitScreen(Z)V

    .line 1992
    .end local v3           #gmail:Ljava/lang/String;
    .end local v5           #res:Ljava/lang/String;
    :goto_1
    move v7, v1

    .line 1993
    .local v7, v:I
    iget-object v8, p0, Lcom/melesta/engine/EngineActivity$18;->val$ea:Lcom/melesta/engine/EngineActivity;

    new-instance v9, Lcom/melesta/engine/EngineActivity$18$1;

    invoke-direct {v9, p0, v7}, Lcom/melesta/engine/EngineActivity$18$1;-><init>(Lcom/melesta/engine/EngineActivity$18;I)V

    invoke-virtual {v8, v9}, Lcom/melesta/engine/EngineActivity;->runOnGLThread(Ljava/lang/Runnable;)V

    .line 2004
    return-void

    .line 1978
    .end local v7           #v:I
    .restart local v3       #gmail:Ljava/lang/String;
    .restart local v4       #jo:Lorg/json/JSONObject;
    .restart local v5       #res:Ljava/lang/String;
    .restart local v6       #rs:I
    :cond_1
    :try_start_1
    const-string v8, "errorCode"

    invoke-virtual {v4, v8}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    move-result v2

    .line 1979
    .local v2, errorCode:I
    const/4 v8, 0x3

    if-ne v2, v8, :cond_0

    .line 1980
    const/4 v1, 0x0

    goto :goto_0

    .line 1985
    .end local v2           #errorCode:I
    .end local v3           #gmail:Ljava/lang/String;
    .end local v4           #jo:Lorg/json/JSONObject;
    .end local v5           #res:Ljava/lang/String;
    .end local v6           #rs:I
    :catch_0
    move-exception v0

    .line 1986
    .local v0, e:Ljava/lang/Exception;
    const/4 v1, 0x2

    .line 1987
    :try_start_2
    invoke-static {v0}, Lcom/melesta/engine/Error;->processException(Ljava/lang/Exception;)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    .line 1989
    iget-object v8, p0, Lcom/melesta/engine/EngineActivity$18;->val$ea:Lcom/melesta/engine/EngineActivity;

    invoke-virtual {v8, v11}, Lcom/melesta/engine/EngineActivity;->showWaitScreen(Z)V

    goto :goto_1

    .end local v0           #e:Ljava/lang/Exception;
    :catchall_0
    move-exception v8

    iget-object v9, p0, Lcom/melesta/engine/EngineActivity$18;->val$ea:Lcom/melesta/engine/EngineActivity;

    invoke-virtual {v9, v11}, Lcom/melesta/engine/EngineActivity;->showWaitScreen(Z)V

    throw v8
.end method
